package com.itheima.bakery.demos.web.model;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "Categories")

public class Category {
    @Id
    private Integer categoryID;

    @Column(name="category_name")
    private String categoryName;

    @Override
    public String toString() {
        return "Category{" +
                "categoryID=" + categoryID +
                ", categoryName='" + categoryName + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Category)) return false;
        Category category = (Category) o;
        return categoryID.equals(category.categoryID);
    }

    @Override
    public int hashCode() {
        return Objects.hash(categoryID);
    }

    // Getters and Setters
    public Integer getCategoryID() {
        return categoryID;
    }
    public void setCategoryID(Integer categoryID) {
        this.categoryID = categoryID;
    }
    public String getCategoryName() {
        return categoryName;
    }
    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
}